package com.ihr360.oneclick.service;


import com.ihr360.oneclick.dto.spreadsheet.SpreadsheetRowDto;
import com.ihr360.oneclick.entity.NotifyStateType;
import com.ihr360.oneclick.entity.RowHeaderColumn;
import com.ihr360.oneclick.entity.SpreadsheetRow;
import com.ihr360.oneclick.request.SearchRequest;
import com.ihr360.oneclick.request.query.SpreadSheetRowQueryParam;
import com.ihr360.oneclick.vo.OneClickResultVo;
import com.ihr360.oneclick.vo.PageData;
import com.ihr360.oneclick.vo.SpreadsheetRowDetailVo;
import com.ihr360.oneclick.vo.SpreadsheetRowVo;
import com.ihr360.oneclick.vo.StaffMessageRecordVo;
import com.ihr360.oneclick.vo.StaffMonthMessageVo;

import java.util.List;
import java.util.Map;

/**
 * @author tom
 */
public interface SpreadsheetRowService {


    /**
     * 获取电子表格行数据的分页数据
     *
     * @param companyId 公司Id
     * @param spreadsheetId SpreadsheetDto.id
     * @param searchRequest 查询请求参数
     * @return SpreadsheetRowPageData
     */
    PageData<SpreadsheetRowVo> getSpreadsheetRowPageData(String companyId, String spreadsheetId, SearchRequest<SpreadSheetRowQueryParam> searchRequest);

    /**
     * 根据员工名录Id获取指定的一键发布数据PageDate
     *
     * @param companyId     公司Id
     * @param String userId 用户Id
     * @param staffRecordId 员工名录Id
     * @param termId        OneClickTerm.id
     * @param searchRequest 查询请求参数
     * @return StaffMessageRecordVo
     */
    StaffMessageRecordVo getStaffRecordSpreadsheetRowPageData(String companyId, String userId, String staffRecordId, String termId,
                                                                          SearchRequest<SpreadSheetRowQueryParam> searchRequest);

    /**
     * 查询员工某一类型发布历史记录，根据所属月份分组
     *
     * @param companyId     公司Id
     * @param mobileNo 员工名录Id
     * @param termId        OneClickTerm.id
     * @return StaffMonthMessage list
     */
    List<StaffMonthMessageVo> getPublishSpreadSheetRowsByTermAndMobileNoGroupByMonth(String companyId, String termId, String mobileNo);

    /**
     * 根据月份查询员工发布历史记录，根据所属月份分组
     *
     * @param companyId     公司Id
     * @param mobileNo 员工名录Id
     * @param termId        OneClickTerm.id
     * @param month         月份
     * @return StaffBatchMessageVo
     */
    StaffMonthMessageVo getPublishSpreadSheetRowsByTermAndMobileNoAndMonth(String companyId, String termId, String mobileNo, String month);

    /**
     * 根据月份查询员工发布历史记录，根据所属月份分组
     *
     * @param companyId     公司Id
     * @param mobileNo      员工手机号码
     * @param termId        OneClickTerm.id
     * @param month         月份
     * @return StaffBatchMessageVo
     *//*
    StaffMonthMessageVo getPublishSpreadSheetRowsByTermAndMobileNoAndMonth(String companyId, String termId, String mobileNo, String month);*/

    /**
     * 根据spreadsheetId 获取row list
     *
     * @param spreadsheetId
     * @return
     */
    List<SpreadsheetRow> getSpreadsheetRowBySpreadsheetId(String spreadsheetId);

    /**
     * 获取可发布的row
     */
    List<SpreadsheetRowDto> getCanPublishRow(String companyId, String spreadsheetId,  Map<String, RowHeaderColumn> fixedColumnMap);

    void deleteByIdList(String spreadsheetId, List<String> idList);

    void deleteAll(String spreadsheetId);

    List<SpreadsheetRowDto> getAllRow(String spreadsheetId);

    /**
     * 根据row id,姓名 返回页面模板
     * @param id
     * @return
     */
    String getSpreadSheetRowById(String id,String userName);

    /**
     * 根据手机号获取最近六个月的公司信息
     * @param mobileNo
     * @return
     */
    List<String> findByMobileNo(String mobileNo);

    void checLastName(String functionId, String companyId, String mobileNo, String userName);

    /**
     * 根据rowid 返回详细数据
     * @param spreadSheetRowId
     * @return
     */
    SpreadsheetRowDetailVo getSpreadsheetRowInfo(String spreadSheetRowId);

    /**
     * 修改row信息
     * @param spreadsheetRowDetailVo
     */
    void updateSpreadsheetRowInfo(SpreadsheetRowDetailVo spreadsheetRowDetailVo, String spreadsheetRowId);

    /**
     * 获取发送结果
     * @param spreadsheetId
     * @return
     */
    OneClickResultVo getNoticeResult(String spreadsheetId);

    String test(String shorUrl);

    void updateSpreadsheetRowNoticeStatus(String id, NotifyStateType notifyStateType,int type);

    /**
     * 校验当前行 是否已经发布
     * @param spreadSheetRowId
     * @return
     */
    Boolean checkSpreadsheetRowIsPublish(String spreadSheetRowId);
}